<?php
require_once './admin-header.php';
if (!isset($_SESSION['uid']) || !isset($_GET['tid']) || !isset($_GET['bid'])) {
    ?>
    <script>history.go(-1);</script>
    <?php
    return 0;
} else {
    $uid = $_SESSION['uid'];
    $tid = $_GET['tid'];
    $bid = $_GET['bid'];
}
require_once './core/admin-sql.php';
$sql = new AdminSql();
?>
    <!DOCTYPE html>
    <html lang="zh-CN">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="initial-scale=1.0,width=device-width,user-scalable=0,maximum-scale=1.0"/>
        <title>我的报名</title>
        <link rel="stylesheet" href="../css/base.css">
        <link rel="stylesheet" href="../css/index.css">

        <script>
            function adapte() {//适配
                var designWidth = 1080, rem2px = 100;
                document.documentElement.style.fontSize = window.innerWidth / designWidth * rem2px + "px";
            }
            adapte();
        </script>
        <style>
        </style>
    </head>
    <body>
    <div class="my-apply3 fs36">
        <div class="apply-top">
            <ul class="flex2">
                <li>
                    <button class="del"><a class="fs36" href="javascript:;"
                                           onclick="deleteApply3(<?= $uid ?>, <?= $tid ?>, <?= $bid ?>)">删除</a></button>
                    /
                    <button><a class="fs36" href="javascript:;">导出</a></button>
                </li>
            </ul>
        </div>
        <div class="apply-bottom">
            <ul class="list">
                <?php
                $allUserFormArray = $sql->searchUsersForm($bid, $uid, $tid);
                if ($allUserFormArray[0] === 0) {
                    $all_array = $allUserFormArray[1];
                    $key_array = array_keys($all_array);
                    $num = count($key_array);
                for ($i = 0;
                     $i < $num;
                     $i++) {
                    $quName = $key_array[$i];
                    $quAnswer_array = $all_array[$quName];
                    ?>
                    <li>
                        <ul class="list1 flex2">
                            <li><?= $quName ?></li>
                            <?php
                            $quAnswer_count = count($quAnswer_array);
                            if ($quAnswer_count > 1) {
                                ?>
                                <ul class="list3 flex">
                                    <?php
                                    for ($j = 0; $j < $quAnswer_count; $j++) {
                                        ?>
                                        <li><?= $quAnswer_array[$j] ?></li>
                                        <?php
                                    }
                                    ?>
                                </ul>
                                <?php
                            } else {
                                ?>
                                <li><?= $quAnswer_array[0] ?></li>
                                <?php
                            }
                            ?>
                        </ul>
                    </li>
                <?php
                }
                } else {
                ?>
                    <script>
                        window.location.href = "./my.php";
                    </script>
                    <?php
                }
                ?>
            </ul>
        </div>
    </div>
    <script src='../script/jquery.js'></script>
    <script src='../script/index.js'></script>
    </body>
    </html>
<?php
require_once './admin-footer.php';